home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / keyin11.zip / KEYIN.DOC < prev   
Text File  |  1992-05-03  |  8KB  |  166 lines

  1. ┌──────┬─┬─┐
  2. │   ┌─┐│ │ │
  3. │┌─┐│ ││ │ │
  4. ││ │╪ ││ │ │
  5. ││─┤│ │└┬┘ │
  6. ││ │└─┘inc.│         ┌───────────────────────────────────────────┐
  7. └┴─┴───────┘        ═╡ KEYin v1.1 Copyright (c) 1992 by ADV inc. ╞═
  8.                      └───────────────────────────────────────────┘
  9.  
  10.  
  11.                 INTRODUCTION
  12.                 ────────────
  13.  
  14.                 If this is the second time you have downloaded KEYin,
  15.                 you might have noticed the version number.  The old
  16.                 KEYin program did not come with any version number.  It
  17.                 was supposed to be the only version to be published --
  18.                 the program was too simple for any elaboration.  The
  19.                 reason this program now bears a version number is that a
  20.                 major mistake was made in the documentation.  There is
  21.                 no change in the program itself; only this documentation
  22.                 is altered.  Anyway, KEYin is the tool you need to
  23.                 create interactive batch files.
  24.  
  25.  
  26.                 WHY ?
  27.                 ─────
  28.  
  29.                 I've seen many bulletin board messages regarding batch
  30.                 file enhancements that allow you to do wonderful stuff
  31.                 in batch file programming.  They mentioned the use of
  32.                 Norton Utilities' BE and other great programs.  These
  33.                 are great for you and I if we have the software, but
  34.                 even though we do have the software, aren't they taking
  35.                 a bit of space on your disk (I mean floppy!).  And it
  36.                 takes long time to load these programs.  (How big is BE
  37.                 really?)  KEYin is only 300 bytes long!  Another thing I
  38.                 forgot to mention is you have to learn a new language
  39.                 that is interpreted by these programs.  Why not stick to
  40.                 the old DOS's batch language?
  41.  
  42.  
  43.                 SO WHAT ?
  44.                 ─────────
  45.  
  46.                 KEYin allows you to ask a user for input of a character.
  47.                 The way to use it is where in your batch file you want
  48.                 to ask a question that requires only a key press such as
  49.                 a yes/no type question or a menu choice type, insert the
  50.                 command KEYin (on a single line).  When the batch file
  51.                 is read at that point, the user will be prompted for a
  52.                 key press.  When the user presses a key, the ASCII code
  53.                 of that key is passed from KEYin to the batch file in
  54.                 the form of an ERRORLEVEL value.  You could then check
  55.                 the ERRORLEVEL to see which key has been press and
  56.                 proceed accordingly.
  57.  
  58.  
  59.                 FORMAT
  60.                 ──────
  61.  
  62.                 KEYin [x] [y] ["string"]
  63.                     -x is an integer value ranging from 1 to 80.
  64.                     -y is an integer value ranging from 1 to 25.
  65.                     -string is a set of characters enclosed in quotation
  66.                      marks.
  67.  
  68.                 If x or y is out of bound, the value will be corrected.
  69.                 The string always starts with a quotation mark.  It
  70.                 doesn't have to end with one though, but it's a good
  71.                 habit to end a string with the quotation mark isn't it?
  72.  
  73.                 With these parameters, KEYin will position the cursor at
  74.                 (x,y), print a message (if any), and then asks for input
  75.                 of a key.
  76.  
  77.  
  78.                 HOW IT WORKS
  79.                 ────────────
  80.  
  81.                 KEYin will look for 2 numbers (the parameters you give)
  82.                 first.  That means 2 numbers -- not letters.  Any
  83.                 numbers afterwards don't count!  Then it will search for
  84.                 a string beginning with a quotation mark.
  85.  
  86.                 What all that means is that anything can be inserted
  87.                 between the numbers and string.  For example, the
  88.                 following commands are all valid:
  89.  
  90.                         keyin 14 5 "Enter you choice: "
  91.                         keyin 14    5  "Enter you choice: "
  92.                         keyin 14,5,"Enter your choice: "
  93.                         keyin junk14again5,what?"Enter your choice: "
  94.                         keyin 14 5 3 4 2 "Enter your choice: "
  95.                         keyin 14 5 3 4 2 "Enter your choice:
  96.                         keyin 14 k5 5 3 Enter"Enter you choice:
  97.  
  98.                 All the above will result in the same output.  Note that
  99.                 some doesn't end with a quotation mark and that there
  100.                 are extra number following the two first numbers.
  101.  
  102.  
  103.                 EXAMPLE
  104.                 ───────
  105.  
  106.                 Here's an example how to implement KEYin:
  107.  
  108.                         @echo off
  109.                         :START
  110.                         cls
  111.                         echo ╔════════════════════════════════════════════╗
  112.                         echo ║     TODAY'S PROGRAM MENU BY ADV inc.       ║
  113.                         echo ║                                            ║
  114.                         echo ║ 1. WordPerfect           5. Space Invaders ║
  115.                         echo ║ 2. Lotus 1-2-3           6. Indiana Jones  ║
  116.                         echo ║ 3. Harvard Graphics                        ║
  117.                         echo ║ 4. Telix                 0. Quit           ║
  118.                         echo ║                                            ║
  119.                         echo ║ Select a number:                           ║
  120.                         echo ║                                            ║
  121.                         echo ╚════════════════════════════════════════════╝
  122.                         KEYin 20 9
  123.                         if errorlevel == 55 goto START
  124.                         if errorlevel == 54 goto INDY
  125.                         if errorlevel == 53 goto SPACE
  126.                         if errorlevel == 52 goto TELIX
  127.                         if errorlevel == 51 goto GRAPHICS
  128.                         if errorlevel == 50 goto 123
  129.                         if errorlevel == 49 goto WP
  130.                         if errorlevel == 48 goto END
  131.                         goto START
  132.  
  133.                         :INDY
  134.                         cd c:\games\indy
  135.                         indy
  136.                         cd c:\
  137.                         goto START
  138.                         .
  139.                         .
  140.                         .
  141.                         :END
  142.                         echo GoodBye!
  143.  
  144.                 Note that the keyin command does not print a string in
  145.                 this case because none is provided.  This shows how you
  146.                 can implement KEYin in a menu system using batch
  147.                 programming.
  148.  
  149.  
  150.                 TRADEMARKS AND SO FORTH
  151.                 ───────────────────────
  152.  
  153.                 I hope you will find this program useful in your batch
  154.                 file programming.  At least, it does help me a little!
  155.                 Enjoy batch programming!!
  156.  
  157.                 Here comes the fix for the error made in the previous
  158.                 documentation.  KEYin is NOT shareware or is it Public
  159.                 Domain.  KEYin is a free program.  The program and
  160.                 documentation are copyrighted.  All rights reserved.  If
  161.                 you distribute it, do not leave this text file out
  162.                 please.
  163.  
  164.                 All trademarks and copyrights belong to their respective
  165.                 owners.
  166.